package org.xxx.epms.result.controller;

import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.xxx.epms.common.api.CommonResult;
import org.xxx.epms.result.models.AqiGrade;
import org.xxx.epms.result.service.AqiGradeService;
import java.util.List;

@RestController
@RequestMapping("/result/aqigrade")
public class AqiGradeController {
    @Autowired
    private AqiGradeService aqigradeService;

    @RequestMapping(value = "/getAqiGradeByLevel", method = RequestMethod.GET)
    @ApiModelProperty(value = "根据aqiLevel获取aqiGrade", notes = "根据aqiLevel获取aqiGrade")
    public CommonResult<AqiGrade> getAqiGradeByLevel(@RequestParam("aqiLevel") Integer aqiLevel){
        return CommonResult.success(aqigradeService.getAqiGradeByLevel(aqiLevel));
    }

    @RequestMapping(value = "/getAqiGrades", method = RequestMethod.POST)
    @ApiOperation(value = "获取所有aqiGrade", notes = "获取所有aqiGrade")
    public CommonResult<List<AqiGrade>> getAqiGrades(){
        return CommonResult.success(aqigradeService.listAqiGrades());
    }

    @RequestMapping(value = "/getAqiGradeByCoValue", method = RequestMethod.GET)
    @ApiModelProperty(value = "根据coValue获取aqiGrade", notes = "根据coValue获取aqiGrade")
    public Integer getAqiGradeByCoValue(@RequestParam("coValue")Integer coValue){
        return aqigradeService.getAqiGradeByCoValue(coValue);
    }

    @RequestMapping(value = "/getAqiGradeBySo2Value", method = RequestMethod.GET)
    @ApiModelProperty(value = "根据so2Value获取aqiGrade", notes = "根据so2Value获取aqiGrade")
    public Integer getAqiGradeBySo2Value(@RequestParam("so2Value") Integer so2Value){
        return aqigradeService.getAqiGradeBySo2Value(so2Value);
    }

    @RequestMapping(value = "/getAqiGradeByPmValue", method = RequestMethod.GET)
    @ApiModelProperty(value = "根据pmValue获取aqiGrade", notes = "根据pmValue获取aqiGrade")
    public Integer getAqiGradeByPmValue(@RequestParam("pmValue") Integer pmValue){
        return aqigradeService.getAqiGradeByPmValue(pmValue);
    }
}
